<!DOCTYPE html>
<html lang="zh-CN">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>手动添加到收藏夹</title>
</head>

<body>
  <a href=# onclick="javascript:addFavorite()" rel=sidebar>加入收藏</a>
</body>
<script>
  "use strict";
  let addFavorite = (sURL = "baidu.com", sTitle = "我是百度") => {
    try {
      window.external.addFavorite(sURL, sTitle);
    } catch (e) {
      try {
        window.sidebar.addPanel(sTitle, sURL, "");
      } catch (e) {
        alert("加入收藏失败，请使用Ctrl+D进行添加");
      }
    }
  };
</script>

</html>